import request from '@/api/request'

const pre = 'zdm'

function discardParam(params) {
    for (let key in params) {
        if (params[key] == '') {
            delete params[key]
        }
    }
    return params
}

export function getList(params) {
    return request.get(`${pre}/activity/list`, { params });
}

export function getSingleHot(data) {
    data.model = 'single'
    return request.post(`${pre}/activity/hot`, data);
}

export function resetActivityList() {
    return request.get(`${pre}/add/activity`);
}

export function getAllHot(data) {
    data.model = 'all'
    return request.post(`${pre}/activity/hot`, data);
}

export function addOne(data) {
    return request.post(`${pre}/activity/add/one`, data);
}

export function updateOne(data) {
    return request.put(`${pre}/activity/update/one`, data);
}

export function deleteOne(id) {
    return request.delete(`${pre}/activity/delete/one/${id}`);
}